import java.util.Scanner;

/**
 * Created by L.jp
 * Description:
 * User: 86189
 * Date: 2021-10-07
 * Time: 21:26
 */
public class FindOperation implements Ioperation {
    @Override
    public void work(BookList bookList) {
        if (bookList.getSize() == 0) {
            System.out.println("书库无书");
            return;
        }
        Scanner reader = new Scanner(System.in);
        String name;
        System.out.print("请输入你要查找的书名：");
        name = reader.nextLine();
        for (int i = 0; i < bookList.getSize(); i++) {
            if (name.equals(bookList.getBook(i).getName())) {
                System.out.println("已查询找到该书，信息如下：");
                System.out.println(bookList.getBook(i));
                return;
            }
        }
        System.out.println("未查询到该书");
    }
}



